<?php
define('web_s', 'johnsongod');
$common['cururl'] = 'list';
$common['title'] = '摩托列表';
require 'includes/init.php';

$where = " and is_enable = '1'";
@$models_id = isset($_REQUEST['models_id']) ? $_REQUEST['models_id'] : '';
$models_id = is_numeric($models_id) ? $models_id : ''; 
$where .= $models_id ? " and models_id = '{$models_id}'" : '';
@$type_id = isset($_REQUEST['type_id']) ? $_REQUEST['type_id'] : '';
$type_id = is_numeric($type_id) ? $type_id : ''; 
$where .= $type_id ? " and type_id = '{$type_id}'" : '';
@$price_id = isset($_REQUEST['price_id']) ? $_REQUEST['price_id'] : '';
$price_id = is_numeric($price_id) ? $price_id : ''; 
$where .= $price_id ? " and price_id = '{$price_id}'" : '';
@$area_id = isset($_REQUEST['area_id']) ? $_REQUEST['area_id'] : '';
$area_id = is_numeric($area_id) ? $area_id : ''; 
$where .= $area_id ? " and area_id = '{$area_id}'" : '';

$list = paging('m_goods', "list.php?models_id={$models_id}&type_id={$type_id}&price_id={$price_id}&area_id={$area_id}", $where);
$list['ppage'] = array();
for($i = $list['pagecount'];$i >= 1;$i --){
	$list['ppage'][] = $i;
}
foreach($list['list'] as $k => $v){
	$list['list'][$k]['thumb'] = $db->getOne("select thumb from m_goods_pic where goods_id = {$v['goods_id']} order by id desc limit 1");
}
$smarty->assign('list', $list);

$smarty->display("list.htm");